<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<body>
<div id="ming">
<div id="header">
    <div class="content_pad">
        <h1><a href="./workspace.html">湖南省自来水公司营销管理信息系统</a></h1>

        <ul id="nav">
            <li v-for="menus in Symenus" v-if="menus.onClick&&menus.parent==0" class="nav_dropdown nav_icon">
                <a href="javascript:;"><span :class="menus.icon"></span>{{menus.menuName}}</a>

                <div class="nav_menu">
                    <ul>
                        <li v-for="mus in Symenus" v-if="mus.onClick&&mus.parent==menus.id"><a :href="mus.url">{{mus.menuName}}</a>
                        </li>
                    </ul>
                </div>

            </li>
            <li class="nav_current nav_dropdown nav_icon_only">
                <a href="javascript:;">&nbsp;</a>

                <div class="nav_menu">
                    <ul>
                        <li><a href="../workspace.html">我的工作台</a></li>
                        <li><a href="../page/sys_pwd.html">修改密码</a></li>
                        <li><a href="javascript:;" @click="close()">退出系统</a></li>
                    </ul>
                </div> <!-- .menu -->
            </li>
        </ul>
    </div> <!-- .content_pad -->

</div> <!-- #header -->
    <div id="masthead">
        <div>
            <span id="pagetitle"><a href="javascript:;">我的工作台</a></span>
            <span id="welcome_span">欢迎回来,{{Syemp.empNmae}}</span>
        </div>
    </div> <!-- #masthead -->
</div>
<script type="text/javascript">
    function load() {
        $.getJSON("/Syemp/chax", {}, function (json) {
            ming.Syemp = json;
            $.getJSON("/Syempmenupower/querybyid/" + json.id, {}, function (cson) {
                $.getJSON("/Symenu/queryall", {}, function (json) {
                    ming.Symenus = json;
                    $.each(cson, function () {
                        var mun = this.menuID;
                        $.each(ming.Symenus, function () {
                            if (mun == this.id) {
                                ming.Symenus[this.parent - 1].onClick = true;
                                this.onClick = true;
                            }
                        });
                    });
                });

            });
        });
    }
    var ming = new Vue({
        el: "#ming",
        data: {
            Syemp: '',
            Symenus: ''
        },
        methods: {
            close() {
                $.getJSON("../Syemp/close", {}, function (json) {
                    if (json == 1) {

                        location.href = "../login.html";
                    }
                });
            }
        },
        watch: {
            Symenus: function () {
                this.$nextTick(function () {
                    // $(document).ready(function () {
                    //     Dashboard.init();
                    // });
                });
            }
        },
        created() {
            load();
        }
    });
</script>

</body>

</html>